package com.macro.mall.controller;

import com.macro.mall.common.api.CommonResult;
import com.macro.mall.pojo.CollectionTypeParam;
import com.macro.mall.service.SysCollectionTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/***
 *采集分类 前端控制器
 */
@RestController
@RequestMapping("sys/collectionType")
public class SysCollectionTypeController {


    @Autowired
    private SysCollectionTypeService collectionTypeService;


    /***
     * 查询当前采集分类
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public CommonResult getCollectionType(@PathVariable(value = "id") String id){
        return collectionTypeService.getCollectionType(id);
    }


    /***
     * 条件分页查询采集分类
     * @param param
     * @return
     */
    @GetMapping
    public CommonResult getList(CollectionTypeParam param){
        return collectionTypeService.getList(param);
    }


    /***
     * 添加采集分类
     * @param param
     * @return
     */
    @PostMapping
    public CommonResult addCollectionType(@RequestBody CollectionTypeParam param){
        return collectionTypeService.edit(param);
    }


    /***
     * 修改当前采集分类
     * @param param
     * @return
     */
    @PutMapping
    public CommonResult modifyCollectionType(@RequestBody CollectionTypeParam param){
        return collectionTypeService.edit(param);
    }


    /***
     * 根据id删除采集分类
     * @param id
     * @return
     */
    @DeleteMapping("/{id}")
    public CommonResult deleteCollectionType(@PathVariable(value = "id") String id){
        return collectionTypeService.delete(id);
    }




}
